/**
 * Created by shaoting on 16/10/17.
 */
/**
 * Created by shaoting on 16/10/17.
 */
import React, { Component } from 'react';
import {
    AppRegistry,
    StyleSheet,
    Text,
    View,
    ListView,
    Image,
    TouchableOpacity,
    Platform,
    Dimensions
} from 'react-native';
var WineInfo = require('../Mine/WineInfo.json')
var {width,height} = Dimensions.get('window').height; //屏宽
var DetailsMiddleView = React.createClass({
    getDefaultProps(){
        return{
            detailsBottomCellAction:'',
        }
    },
    //设置初始值
    getInitialState(){
        //设置数据源
        var ds = new ListView.DataSource({rowHasChanged:(r1,r2) => r1 !== r2}); //当且仅当cell中的任意两行不相等时才重新渲染
        //设置返回数据
        return{
            dataSource:ds.cloneWithRows(WineInfo)
        }
    },
    render() {
        return (
            <ListView
                style={styles.container}
                dataSource={this.state.dataSource} //数据源
                renderRow={this.renderRow}

            />
        );
    },
    renderRow(rowData,sectionID,rowID,highlightRow){
        return(
            <View>
                <TouchableOpacity onPress={this.props.detailsBottomCellAction}>
                    <Text style={{marginTop: 5,margin:5}}> {rowData.title}  :  {rowData.value}</Text>
                    <View style={{width:width ,height: 1,backgroundColor:'rgba(200,200,200,1.0)'}}></View>
                </TouchableOpacity>
            </View>
        )
    }
});


var styles = StyleSheet.create({
    container:{
        top:-35,
    }
});

module.exports = DetailsMiddleView;